package com.example.JavaConcurrent.Project3_Phaser.awaitAdvanceInterruptibly_2;

import java.util.concurrent.Phaser;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class ThreadA extends Thread {
    private Phaser phaser;

    public ThreadA(Phaser phaser){
        this.phaser = phaser;
    }

    public void run(){
        try {
            System.out.println(Thread.currentThread().getName()+ "A1 begin=" + System.currentTimeMillis());
            phaser.awaitAdvanceInterruptibly(0);//中断抛出异常
            System.out.println(Thread.currentThread().getName()+ "A1 end=" + System.currentTimeMillis());
        } catch (InterruptedException  e) {
            e.printStackTrace();
        }
    }
}
